import 'package:flutter/material.dart';

class MyApp19 extends StatelessWidget {
  const MyApp19({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // 导航条
      appBar: AppBar(
        title: const Text(
          'CustomScrollView初体验',
          style: TextStyle(color: Colors.white, fontSize: 20),
        ),
        backgroundColor: Colors.pink,
        centerTitle: true,
      ),
      // 主题区域
      body: CustomScrollView(
        slivers: [
          SliverGrid.builder(
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 5,
              mainAxisSpacing: 10,
              crossAxisSpacing: 10,
              childAspectRatio: 1,
            ),
            itemBuilder: (BuildContext context, int index) {
              return Container(
                width: 90,
                height: 90,
                color: Colors.cyan,
                child: Text('gridview$index'),
              );
            },
            itemCount: 10,
          ),
          SliverPadding(padding: EdgeInsets.only(top: 5, bottom: 5)),
          SliverList.builder(
            itemBuilder: (BuildContext context, int index) {
              return Container(
                margin: EdgeInsets.only(bottom: 10),
                height: 80,
                color: Colors.green,
                child: Text('乌萨奇$index'),
              );
            },
          ),
        ],
      ),
    );
  }
}
